From 0f92d4c97358a53183032496361b07843c2e9def Mon Sep 17 00:00:00 2001 From: Jimi Xenidis Date: Mon, 27 Nov 2006 17:17:07 -0500 Subject: [PATCH] [XEN][POWERPC] OFD dump prefix screen and hook into keyhandler This patch adds the ability to view the devtree from the Xen console. Signed-off-by: Jimi Xenidis Signed-off-by: Hollis Blanchard --HG-- extra : transplant_source : %CCE%28-%AF%3D%24/%DC%F6%E8X%C0%B1%8B%7F%10%86%A3%18 --- xen/arch/powerpc/boot_of.c | 2 +- xen/arch/powerpc/of-devtree.h | 6 +++--- xen/arch/powerpc/of-devwalk.c | 14 +++++++------- xen/arch/powerpc/ofd_fixup.c | 2 +- xen/arch/powerpc/setup.c | 19 ++++++++++++++----- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/xen/arch/powerpc/boot_of.c b/xen/arch/powerpc/boot_of.c index 78a31d5b87..26a9ed19eb 100644 --- a/xen/arch/powerpc/boot_of.c +++ b/xen/arch/powerpc/boot_of.c @@ -1069,7 +1069,7 @@ static void * __init boot_of_devtree(module_t *mod, multiboot_info_t *mbi) if (ofd_size(oft) > oft_sz) of_panic("Could not fit all devtree fixups\n"); - ofd_walk(oft, OFD_ROOT, /* add_hype_props */ NULL, 2); + ofd_walk(oft, __func__, OFD_ROOT, /* add_hype_props */ NULL, 2); mod->mod_start = (ulong)oft; mod->mod_end = mod->mod_start + oft_sz; diff --git a/xen/arch/powerpc/of-devtree.h b/xen/arch/powerpc/of-devtree.h index 09e836eff4..8797b5d2e9 100644 --- a/xen/arch/powerpc/of-devtree.h +++ b/xen/arch/powerpc/of-devtree.h @@ -115,10 +115,10 @@ extern u32 ofd_io_open(void *mem, ofdn_t n); extern void ofd_io_close(void *mem, ofdn_t n); -typedef void (*walk_fn)(void *m, ofdn_t p, int arg); -extern void ofd_dump_props(void *m, ofdn_t p, int dump); +typedef void (*walk_fn)(void *m, const char *pre, ofdn_t p, int arg); +extern void ofd_dump_props(void *m, const char *pre, ofdn_t p, int dump); -extern void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg); +extern void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg); /* Recursively look up #address_cells and #size_cells properties */ diff --git a/xen/arch/powerpc/of-devwalk.c b/xen/arch/powerpc/of-devwalk.c index dc57ab7ebe..3f63697f13 100644 --- a/xen/arch/powerpc/of-devwalk.c +++ b/xen/arch/powerpc/of-devwalk.c @@ -80,7 +80,7 @@ void ofd_prop_print( #endif } -void ofd_dump_props(void *mem, ofdn_t n, int dump) +void ofd_dump_props(void *mem, const char *pre, ofdn_t n, int dump) { ofdn_t p; char name[128]; @@ -95,7 +95,7 @@ void ofd_dump_props(void *mem, ofdn_t n, int dump) } if (dump & OFD_DUMP_NAMES) { - printk("of_walk: %s: phandle 0x%x\n", path, n); + printk("%s: %s: phandle 0x%x\n", pre, path, n); } p = ofd_nextprop(mem, n, NULL, name); @@ -106,30 +106,30 @@ void ofd_dump_props(void *mem, ofdn_t n, int dump) } if ( dump & OFD_DUMP_VALUES ) { - ofd_prop_print("of_walk", path, name, prop, sz); + ofd_prop_print(pre, path, name, prop, sz); } p = ofd_nextprop(mem, n, name, name); } } -void ofd_walk(void *m, ofdn_t p, walk_fn fn, int arg) +void ofd_walk(void *m, const char *pre, ofdn_t p, walk_fn fn, int arg) { ofdn_t n; if ( fn != NULL ) { - (*fn)(m, p, arg); + (*fn)(m, pre, p, arg); } /* child */ n = ofd_node_child(m, p); if ( n != 0 ) { - ofd_walk(m, n, fn, arg); + ofd_walk(m, pre, n, fn, arg); } /* peer */ n = ofd_node_peer(m, p); if ( n != 0 ) { - ofd_walk(m, n, fn, arg); + ofd_walk(m, pre, n, fn, arg); } } diff --git a/xen/arch/powerpc/ofd_fixup.c b/xen/arch/powerpc/ofd_fixup.c index 3cb498dda9..d4cae92f31 100644 --- a/xen/arch/powerpc/ofd_fixup.c +++ b/xen/arch/powerpc/ofd_fixup.c @@ -427,7 +427,7 @@ int ofd_dom0_fixup(struct domain *d, ulong mem, start_info_t *si) #ifdef DEBUG - ofd_walk(m, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL); + ofd_walk(m, __func__, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL); #endif return 1; } diff --git a/xen/arch/powerpc/setup.c b/xen/arch/powerpc/setup.c index e0b6e50475..39245d4250 100644 --- a/xen/arch/powerpc/setup.c +++ b/xen/arch/powerpc/setup.c @@ -125,11 +125,19 @@ void noinline __attn(void) console_end_sync(); } -static void hw_probe_attn(unsigned char key, struct cpu_user_regs *regs) +static void key_hw_probe_attn(unsigned char key) { __attn(); } +static void key_ofdump(unsigned char key) +{ + printk("ofdump:\n"); + /* make sure the OF devtree is good */ + ofd_walk((void *)oftree, "devtree", OFD_ROOT, + ofd_dump_props, OFD_DUMP_ALL); +} + static void percpu_init_areas(void) { unsigned int i, data_size = __per_cpu_data_end - __per_cpu_start; @@ -180,7 +188,10 @@ static void __init start_of_day(void) /* Register another key that will allow for the the Harware Probe * to be contacted, this works with RiscWatch probes and should * work with Chronos and FSPs */ - register_irq_keyhandler('^', hw_probe_attn, "Trap to Hardware Probe"); + register_keyhandler('^', key_hw_probe_attn, "Trap to Hardware Probe"); + + /* allow the dumping of the devtree */ + register_keyhandler('D', key_ofdump , "Dump OF Devtree"); timer_init(); serial_init_postirq(); @@ -318,9 +329,7 @@ static void __init __start_xen(multiboot_info_t *mbi) memory_init(mod, mbi->mods_count); #ifdef OF_DEBUG - printk("ofdump:\n"); - /* make sure the OF devtree is good */ - ofd_walk((void *)oftree, OFD_ROOT, ofd_dump_props, OFD_DUMP_ALL); + key_ofdump(0); #endif percpu_init_areas(); -- 2.30.2